package com.product.android.ui.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;

import com.nd.android.u.allcommon.R;
import com.nostra13.universalimageloader.core.ImageLoader;

public class AnimImageView extends ImageView{
	public static final int CURRENT_STOP=3;
//	private static final String TAG = "AnimImageView";
	private int mCurrent=3;
	private int[][] mAudioImageIds=new int[3][]; 
	private int mAudioPosition=0;
	public AnimImageView(Context context) {
		super(context);
		initData();
	}
	
	public AnimImageView(Context context, AttributeSet attrs) {
		super(context, attrs);
		initData();
	}
	
	private void initData(){
		int[] fromImages = { R.drawable.chatfrom_voice_playing_f1,
				R.drawable.chatfrom_voice_playing_f2,
				R.drawable.chatfrom_voice_playing_f3,
				R.drawable.chatfrom_voice_playing_f3};
		int[] toImages = { R.drawable.chatto_voice_playing_f1,
				R.drawable.chatto_voice_playing_f2,
				R.drawable.chatto_voice_playing_f3,
				R.drawable.chatto_voice_playing_f3};
		int[] flowerImages = { 
				R.drawable.wbflower_voice_playing_f1,
				R.drawable.wbflower_voice_playing_f2,
				R.drawable.wbflower_voice_playing_f3,
				R.drawable.wbflower_voice_playing};
		
		mAudioImageIds[0]=fromImages;
		mAudioImageIds[1]=toImages;
		mAudioImageIds[2]=flowerImages;
	}
	
	public void setMyTalk(boolean isMyTalk) {
		mAudioPosition=isMyTalk?1:0;
	}
	
	/**
	 * 
	 * @n<b>函数名称</b>     :setFlowerMsgTalk
	 * @brief  设置留言的语音播放图片
	 * @see
	 * @since    Ver 1.1
	 * @param  
	 * @return void
	 * @<b>作者</b>          :  huangszh
	 * @<b>创建时间</b>      :  2013-11-14下午2:01:40
	 */
	public void setFlowerMsgTalk(){
		mAudioPosition=2;
	}
	
	/**
	 * @n<b>函数名称</b>     :showState
	 * @brief 显示当前的状态
	 * @see
	 * @since    Ver 1.2
	 * @param  @param index
	 * @return void
	 * @<b>作者</b>          :  cb
	 * @<b>创建时间</b>      :  2013-8-8上午10:09:44      
	*/
	public void showState(int index){
		mCurrent=index;
		String uri="drawable://"+mAudioImageIds[mAudioPosition][mCurrent];
		ImageLoader.getInstance().displayImage(uri, this);
	}
}